package com.rocketmq.consumer;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 集群消息
 * @author ytj
 * @date 2024/10/10 16:24
 */
@Component
@RocketMQMessageListener(consumerGroup = "boot-product",topic = "cluster_test",messageModel = MessageModel.CLUSTERING)
public class ClusteringTest2 implements RocketMQListener<MessageExt> {


    @Override
    public void onMessage(MessageExt messageExt) {
        System.out.println("rocketmq获取消息(集群2):"+new String(messageExt.getBody()));
    }
}
